//Page Object
import {
  request
} from "../../request/index";
Page({
  data: {
    img_list: [],
    catItems:[],
    floordata: []
  },
  getImg_list() {
    request({
      url: 'https://www.fastmock.site/mock/1c3b14715feef12ca0b201429ce14b2a/shopmall/background_img',
    }).then(res => {
      this.setData({
        img_list: res.data.background_img,
      })
    })
  },
  getCatItem() {
    request({
      url: 'https://www.fastmock.site/mock/5ef0094d6cded52f33526421d6071aa4/shopmall/catItems',
    }).then(res => {
      // console.log(res)
      this.setData({
        catItems: res.data.message,
      })
    })
  },
  getFloordata() {
    request({
      url: 'https://www.fastmock.site/mock/5ef0094d6cded52f33526421d6071aa4/shopmall/floordata',
    }).then(res => {
      // console.log(res)
      this.setData({
        floordata: res.data.message,
      })
    })
  },
  
  //options(Object)
  onLoad: function (options) {
    this.getImg_list(),
    this.getCatItem(),
    this.getFloordata()
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {

  },
  onShareAppMessage: function () {

  },
  onPageScroll: function () {

  },
  //item(index,pagePath,text)
  onTabItemTap: function (item) {

  }
});